"use strict"

const Controller = require('egg').Controller

class AdverController extends Controller{
    // 列表
    async list(){
        const { ctx } = this
        ctx.body = await ctx.service.admin.adver.list(ctx.request.body)
    }
    // (新增/编辑)
    async add_redact() {
        const { ctx } = this
        if(ctx.request.body.id) {
            ctx.body = await ctx.service.admin.adver.redact(ctx.request.body)
        }else{
            ctx.body = await ctx.service.admin.adver.add(ctx.request.body)
        }
    }
    // 详情
    async details() {
        const { ctx } = this
        ctx.body = await ctx.service.admin.adver.details(ctx.request.body)
    }
    // 删除
    async del() {
        const { ctx } = this
        ctx.body = await ctx.service.admin.adver.del(ctx.request.body)
    }
}

module.exports = AdverController